﻿using HCMS.CommonDtos;
using HCMS.Entities.Base;
using HCMS.Repositories.Base;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace HCMS.IServices.Base
{
    /// <summary>
    /// 敏感词 应用服务 接口
    /// </summary>
    public interface ISensitiveWordsAppService : ICommonAppService<BaseDbContext, SensitiveWords>
    {
        /// <summary>
        /// 管理 列表
        /// </summary>
        /// <param name="searchArgs">搜索 参数</param>
        /// <param name="pager">分页 参数</param>
        /// <returns></returns>
        Task<ListPagerDto<object>> ManageList(SearchArgsDto searchArgs, PagerArgsDto pager);

        /// <summary>
        /// 判断敏感词是否重复
        /// </summary>
        /// <remarks>
        /// 不允许创建重复的敏感词
        /// </remarks>
        /// <param name="id">当前的敏感词 Id</param>
        /// <param name="title">敏感词</param>
        /// <returns>true：重复，false：不存在重复</returns>
        Task<bool> HasRepeat(int id, string title);

        /// <summary>
        /// 替换敏感词
        /// </summary>
        /// <remarks>
        /// 敏感词 替换为 * 
        /// </remarks>
        /// <param name="content">原始内容</param>
        /// <param name="classIds">分类 Ids</param>
        /// <returns>替换后的内容</returns>
        Task<string> SensitiveReplace(string content, int[] classIds);

        /// <summary>
        /// 敏感词 提示
        /// </summary>
        /// <param name="content">原始内容</param>
        /// <param name="classIds">分类 Ids</param>
        /// <returns>存在敏感词，返回提示。不存在，返回空</returns>
        Task<string> SensitiveTips(string content, int[] classIds);

        /// <summary>
        /// 获取全部列表
        /// </summary>
        /// <param name="isRefreshCache">是否刷新缓存</param>
        /// <returns></returns>
        Task<List<SensitiveWords>> AllList(bool isRefreshCache = false);

    }
}
